package com.jzhao.gper.strategy;

import com.alibaba.fastjson.JSONObject;

import java.util.Iterator;
import java.util.Set;

public class Test {
    public static void main(String[] args) {
        Set<String> types = CoverpageStrategyFacory.getCoverpageTypes();
        Iterator<String> iterator= types.iterator();
        while (iterator.hasNext()){
            JSONObject coverPage = getCoverPageAndChildsById(iterator.next(),"1111111","222222");
            System.out.println(coverPage);
        }

    }

    /**
     * 通过策略模式获取投资摘要manager
     * @param coverPageTemplate
     * @param targetId
     * @param coverPageId
     * @return
     */
    public static JSONObject getCoverPageAndChildsById(String coverPageTemplate,String targetId, String coverPageId) {
        JSONObject coverPage=null;
        ICoverpageManager coverpageManager = CoverpageStrategyFacory.getCoverpageManager(coverPageTemplate);
        coverPage = coverpageManager.getObjectAndChilds(targetId,coverPageId);
        return coverPage;
    }
}
